package com.guaju.yueshangLife.base;

import android.content.Intent;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.v7.app.AppCompatActivity;

import com.guaju.yueshangLife.activity.NetErrorActivity;
import com.guaju.yueshangLife.global.BaseApplication;
import com.guaju.yueshangLife.net.NetworkUtil;
import com.guaju.yueshangLife.utils.AppManager;

public class MyAppcomActivity extends AppCompatActivity {

    @Override
    public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
        super.onCreate(savedInstanceState, persistentState);
        AppManager.getAppManager().addActivity(this);
    }

    @Override
    protected void onResume() {
        super.onResume();
        showNetError();
    }

    public void showNetError() {
        if (!NetworkUtil.isConnected(this) &&(!BaseApplication.getInstance().isFinishable())) {
            if (((!BaseApplication.getInstance().isFinishable()))){
                startActivity(new Intent(this, NetErrorActivity.class));

            }
        }
    }



}
